﻿using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using DBUtility;
using IDAL;
using Model;

namespace DAL
{
    public class AgingItem : BaseRepository<AgingItemInfo>, IAgingItem 
    {
        private const string PARM_AGING_DT = "@AgingItemdt";
        private const string PARM_AGING_ID = "@AgingID";

        private const string PARM_PCBAGING_ID = "@PCBAgingID";
        
        public IList<AgingItemInfo> GetAgingItemsbyID(string agingID)
        {
            SqlParameter parm = new SqlParameter(PARM_AGING_ID, SqlDbType.NVarChar, 50);
            //Bind the parameter
            parm.Value = agingID;
            return ExcuteSqlToGetEntities("AgingItem_SelectbyAgingID", parm);
        }

        public IList<AgingItemInfo> GetPCBAgingItemsbyID(string pCBAgingID)
        {
            SqlParameter parm = new SqlParameter(PARM_PCBAGING_ID, SqlDbType.NVarChar, 50);
            //Bind the parameter
            parm.Value = pCBAgingID;
            return ExcuteSqlToGetEntities("PCBAgingItem_SelectbyPCBAgingID", parm);
        }

        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override AgingItemInfo GetEntityRecord(SqlDataReader rdr)
        {
            AgingItemInfo pro = new AgingItemInfo(rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString());
            return pro;
        }
    }
}
